import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
dayjs.extend(utc)

export function formatUTC(utcString: string, format = 'YYYY-MM-DD HH:mm:ss') {
  // .utc() => 解析UTC时间字符串
  // .utcOffset(8) => 在原来的UTC时间的基础上偏移（加上）8小时
  const resultTime = dayjs.utc(utcString).utcOffset(8).format(format)
  return resultTime
}
